package org.swift.mashup.engine.model;

import org.swift.mashup.engine.InitializationException;
import org.swift.mashup.engine.MashupException;
import org.swift.mashup.engine.concurrency.execution.ExecutionOutput;
import org.swift.mashup.engine.concurrency.execution.Rule;
import org.swift.mashup.engine.concurrency.execution.RuleSet;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Map;

public interface Mashup {

    Collection<String> getParameterNames();

    void load(InputStream stream) throws ParserConfigurationException,
            SAXException, IOException, InitializationException, ParseException;

    void load(Document mashupXml) throws ParserConfigurationException,
                    SAXException, IOException, InitializationException, ParseException;

    ExecutionOutput run(Map parameters);

    String runConcurrent(String processid, String sessionid,
                         String workingDirectory, int startIndex, int endIndex) throws MashupException;

    boolean isParallel();

    void setParallel(boolean parallel);

    String getName();

    RuleSet getRuleSet();

    Map<String, Rule> findReferencedRules(String ruleName);

    void setNewRules(Collection<Rule> newRules);

    Document getMashupXml();

    Document getSchema();

    Document getValidationRules();

    String getDocumentation();
}
